package com.ittao.taoaicodemother.manage.storage.enums;

import lombok.Getter;

/**
 * 存储类型枚举
 * 支持本地文件存储和腾讯云COS存储
 */
@Getter
public enum StorageType {
    /**
     * 本地文件存储
     */
    LOCAL("local", "本地存储"),
    
    /**
     * 腾讯云COS存储
     */
    COS("cos", "腾讯云COS存储");
    
    private final String code;
    private final String description;
    
    StorageType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * 根据代码获取存储类型
     */
    public static StorageType fromCode(String code) {
        for (StorageType type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        return LOCAL; // 默认返回本地存储
    }
}